package org.hefan.hrm.controller;

import org.hefan.hrm.service.IImageVerifyCodeService;
import org.hefan.hrm.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/imageVerifyCode")
public class ImageVerifyCodeController {

    @Autowired
    private IImageVerifyCodeService imageVerifyCodeService;

    @GetMapping("/{imageCodeKey}")
    public AjaxResult getCodeByKey(@PathVariable("imageCodeKey")String imageCodeKey) {
        return imageVerifyCodeService.getCodeByKey(imageCodeKey);
    }

    @PostMapping("/verify")
    public AjaxResult getCodeByKey(@RequestBody Map<String, String> params) {
        return imageVerifyCodeService.verifyCode(params);
    }
}
